module ApplicationHelper
	def hidden_div_if(condition, attributes = {}, &block)
if condition
attributes["style"] = "display: none"
end
content_tag("div", attributes, &block)
end

	def is_admin?
		user= User.find_by(id: session[:user_id])
        		user.id==1
	end

	def current_user
	@current_user ||= User.find_by(id: session[:user_id])
	end

	def current_user_name
	user= User.find_by(id: session[:user_id]).name
	end

	def log_in?
		user= User.find_by(id: session[:user_id])
		user.nil?
	end

	def has_any_comment?(product)
		product.comments.count>0
	end
end
